home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / GCC 1.37.1r14 / usr / gcc-1.37.1r14 / object oriented files / CResListPane.cp < prev    next >
Encoding:
Text File  |  1993-01-20  |  2.0 KB  |  79 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  CResListPane.c
  3.  
  4.         A subclass of CArrayPane that displays a list of resources. The
  5.         resource information in an array of structs of type tResourceInfo.
  6.         
  7.     SUPERCLASS = CArrayPane
  8.     
  9.     Copyright © 1991 Symantec Corporation. All rights reserved.
  10.     
  11.  
  12.  ******************************************************************************/
  13.  
  14. #include "CResListPane.h"
  15. #include "ResourceStructs.h"
  16. #include "CArray.h"
  17. #include "Packages.h"
  18.  
  19.     // fixed offsets for drawing resource info in cells
  20.     
  21. #define kSizeOffset        50
  22. #define kNameOffset        100
  23.  
  24. /******************************************************************************
  25.  IResListPane
  26.  
  27.      Initialization method for CResListPane.
  28.      
  29. ******************************************************************************/
  30.  
  31. void CResListPane::IResListPane( CView *anEnclosure, CBureaucrat *aSupervisor,
  32.                         short aWidth, short aHeight,
  33.                         short aHEncl, short aVEncl,
  34.                         SizingOption aHSizing, SizingOption aVSizing)
  35. {
  36.     CArrayPane::IArrayPane( anEnclosure, aSupervisor, aWidth, aHeight,
  37.             aHEncl, aVEncl, aHSizing, aVSizing);
  38. }
  39.                             
  40. /******************************************************************************
  41.  DrawCell
  42.  
  43.      Called to draw a single cell. This method retrieves the tResourceInfo 
  44.      array entry associated with the cell, and draws the data in the cell.
  45.      
  46. ******************************************************************************/
  47.  
  48. void CResListPane::DrawCell( Cell theCell, Rect *cellRect)
  49. {
  50.     tResourceInfo    resInfo;
  51.     short    hStart, vStart;
  52.     Str255    buf;
  53.     
  54.     if (!itsArray) return;
  55.     
  56.     itsArray->GetItem( &resInfo, theCell.v + 1);
  57.     
  58.     hStart = cellRect->left + indent.h;
  59.     vStart = cellRect->top + indent.v;
  60.     
  61.         // draw resource ID
  62.         
  63.     MoveTo( hStart, vStart);
  64.     NumToString( resInfo.ID, buf);
  65.     DrawString( buf);
  66.     
  67.         // draw resource size
  68.  
  69.     MoveTo( hStart + kSizeOffset, vStart);
  70.     NumToString( resInfo.size, buf);
  71.     DrawString( buf);
  72.  
  73.         // draw resource name
  74.  
  75.     MoveTo( hStart + kNameOffset, vStart);
  76.     DrawString( resInfo.name);
  77. }
  78.  
  79.